﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace DocumentsTagger.DM
{
    public class Tag
    {
        private readonly String r_TagName;
        private readonly List<String> r_GoodWords = new List<string>();
        private readonly List<String> r_BadWords = new List<string>();

        public List<string> GoodWords { get { return r_GoodWords; } }
        public List<string> BadWords { get { return r_BadWords; } }

        public string Name { get { return this.r_TagName; } }

        public Tag(string tagName)
        {
            this.r_TagName = tagName;
        }


        public override bool Equals(object obj)
        {
            //       
            // See the full list of guidelines at
            //   http://go.microsoft.com/fwlink/?LinkID=85237  
            // and also the guidance for operator== at
            //   http://go.microsoft.com/fwlink/?LinkId=85238
            //

            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }

            return r_TagName.Equals(((Tag)obj).Name);
        }

        // override object.GetHashCode
        public override int GetHashCode()
        {
            return r_TagName.GetHashCode();
        }

        public override string ToString()
        {
            return Name;
        }

        public void AddGoodWord(string word)
        {
            word = word.ToLower();
            if (!r_GoodWords.Contains(word))
            {
                r_GoodWords.Add(word);
            }
        }

        public void AddBadWord(string word)
        {
            word = word.ToLower();
            if (!r_BadWords.Contains(word))
            {
                r_BadWords.Add(word);
            }
        }

        public int DocumentsLearnt { get; set; }
    }
}
